# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/29 下午3:59
 @Author  : tgy
 
"""

class Attribute:
    ...

    def _attr(self):
        attrs = (f'{attr}={str(getattr(self,attr))}' for attr in sorted(self.__dict__.keys()))
        return ','.join(attrs)

    def __str__(self):
        ...
        class_name = self.__class__.__name__
        return '{}[{}]'.format(class_name, self._attr())


if __name__ == '__main__':
    ...
    # print(str(None))
    attr = Attribute()
    attr.name = 'zhangsan'
    attr.age = 21
    print(attr)